package com.lzz.utils;

import javafx.beans.binding.ObjectExpression;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 全局异常处理类
 * @author zhenzhen
 * @date 2018-12-17 下午8:49
 */
//@ControllerAdvice
public class GlobalDefaultExceptionHandler {
//    @ExceptionHandler(Exception.class)
//    @ResponseBody
    public Map<String, Object> defaultExceptionHandler(Exception e) {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 500);
        map.put("msg", e.getMessage());
        return map;
    }
}
